<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="javax.jdo.Query" %>
<%@ page import="de.tuhrig.sportlog.pmf.PMF" %>
<%@ page import="de.tuhrig.sportlog.pmf.queries.QueryFactory" %>

<html>
	<head>
		<%@ include file="controls/Meta.jsp" %>
	</head>
	
	<div id='container'>
		<%@ include file="controls/Header.jsp" %>
		<%@ include file="controls/Left.jsp" %>
		<%@ include file="controls/Right.jsp" %>
		
		<div id='content'>
		
		<%
			if(user != null) {
				
				PersistenceManager pm2 = PMF.get().getPersistenceManager();
			    
	            Query query2 = new QueryFactory(pm2).countAllLogsFromUserId();
		%>
        	<h1>Account Information</h1>
        	<p><b>User ID:</b> <%= user.getUserId() %> </p>
        	<p><b>Nickname:</b> <%= user.getNickname() %> </p>
        	<p><b>eMail:</b> <%= user.getEmail() %> </p>        
        	<p><b>Logs:</b> <%= query2.execute(user.getUserId()) %></p>

			<p><a href="Logs.jsp">View your logs</a></p>
		<%
            	query2.closeAll();
            
            	pm2.close();
        	}
		%>
		</div>
		<%@ include file="controls/Footer.jsp" %>
	</div>
</html>